package cn.xfdzx.android.apps.shop.adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.ArrayList;
import java.util.List;

import cn.xfdzx.android.apps.shop.R;
import cn.xfdzx.android.apps.shop.bean.DetailPringBean;

/**
 * Creator: zf.
 * Date: 2020/8/19.
 * Description:商家订单列表适配器.
 */
public class OrderDetailPringListAdapter extends BaseQuickAdapter<DetailPringBean.DataBean.GoodsListBean, BaseViewHolder> {
    private List<DetailPringBean.DataBean.GoodsListBean> dataBeans = new ArrayList<>();//商品列表

    public OrderDetailPringListAdapter(@Nullable List<DetailPringBean.DataBean.GoodsListBean> data) {
        super(R.layout.item_orderdetailpring, data);
        this.dataBeans = data;
    }

    @Override
    public void setData(int index, @NonNull DetailPringBean.DataBean.GoodsListBean data) {
        super.setData(index, data);
    }


    @Override
    protected void convert(final BaseViewHolder viewHolder, final DetailPringBean.DataBean.GoodsListBean date) {

        viewHolder.setText(R.id.tv_title,date.getTitle()+" x"+date.getNum())
                .setText(R.id.tv_num,"¥"+date.getPrice());

       // Glide.with(mContext).load(mList.get(position).getThumb()).apply(options.transform(mation)).into(holder.ivFineSelect);
    }
    public void clearDatas(){
        mData.clear();
        notifyDataSetChanged();
    }
    public void refreshDatas(List<DetailPringBean.DataBean.GoodsListBean> list){
        this.dataBeans = list;
        super.replaceData(list);
    }

    public void addDatas(List<DetailPringBean.DataBean.GoodsListBean>  list){
        super.addData(list);
        //mData.addAll(list);
    }


}
